<template>
	<view></view>
</template>

<script>
	import jyfParser from "@/components/jyf-parser/jyf-parser";
	import {downloadFile} from '@/utils/toPath.js';
	export default {
		components: {
			jyfParser,
		},
		data() {
			return {
				contract: {}
			}
		},
		onLoad(option) {
			let orderId = option.orderid
			this.getContract(orderId)
		},
		methods: {
			// 获取合同详情
			async getContract(orderid) {
				let params = {
					method: 'api/v2/order/get_contract_content',
					id: orderid
				};
				uni.showLoading({
					title: '加载中...'
				})
				let res = await this.$http(params);
				uni.hideLoading();
				if (res.status) {
					this.contract = res.data;
					// 设置顶部标题栏
					uni.setNavigationBarTitle({
						title: this.contract.title
					});
					
					// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-ALIPAY
					let cpath = encodeURIComponent(this.contract.url)
					uni.navigateTo({
						url: '/pages/ubase/webview?path=' + cpath + '&adname=' + this.contract.title
					})
					// #endif
					
					// #ifdef H5
					window.open(this.contract.url)
					// #endif
					
				} else {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
				}
			}
			
		}
	}
</script>

<style lang="scss">
.save-file-btn {
			width: 100%;
			height: 40rpx;
			vertical-align: middle;
			display: flex; 
			flex-direction: row; 
			justify-content: center;
			/* border-radius: 20rpx; */
			font-size: $uni-font-size-lg;
			color: $uni-color-success;
			/* border: 1rpx solid $uni-color-success; */
			text-decoration: none;
			
		}
</style>
